package com.chainyoung.component_tmtrade.ui.mvp.model;

import com.chainyoung.common.appcommon.entity.CommonList;
import com.chainyoung.common.appcommon.entity.RecieveAccount;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmtrade.api.TradeService;
import com.chainyoung.component_tmtrade.bean.FiatTradeListItem;
import com.chainyoung.component_tmtrade.bean.TradeResult;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeFiatCurrencySubmitOrderContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;

@ActivityScope
public class TradeFiatCurrencySubmitOrderModel extends BaseModel implements TradeFiatCurrencySubmitOrderContract.Model{


    @Inject
    public TradeFiatCurrencySubmitOrderModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public Flowable<TradeResult> submitFiatCurrencyOrder(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(TradeService.class)
                .submitOrder(map)
                .compose(RxUtils.<TradeResult>handleResult());
    }

    @Override
    public Flowable<List<RecieveAccount>> getRecieveAccount(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(TradeService.class)
                .getRecieveAccount(map)
                .compose(RxUtils.<List<RecieveAccount>>handleResult());
    }
}
